package com.fqh.service.impl;

import com.fqh.entity.Foodclass;
import com.fqh.mapper.FoodClassMapper;
import com.fqh.service.FoodClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FoodClassServiceImpl implements FoodClassService {
    @Autowired
    private FoodClassMapper mapper;

    @Override
    public List<Foodclass> findByPage(int page, int limit) {
        page = (page - 1) * limit;
        return mapper.findByPage(page, limit);
    }

    @Override
    public Integer findCount() {
        return mapper.findCount();
    }

    @Override
    public List<Foodclass> findFoodClass() {
        return mapper.findFoodClass();
    }

    @Override
    public Integer findFoodInfo(Integer classId) {
        return mapper.findFoodInfo(classId);
    }

    @Override
    public Foodclass findFoodClassById(Integer classId) {
        return mapper.findFoodClassById(classId);
    }

    @Override
    public Integer updateById(Foodclass foodclass) throws Exception {
        return mapper.updateById(foodclass);
    }

    @Override
    public Integer insert(String className) throws Exception {
        return mapper.insert(className);
    }

    @Override
    public Integer deleteById(int parseInt) throws Exception {
        return mapper.deleteById(parseInt);
    }

    @Override
    public Integer findFoodIdByClassName(String className) {
        return mapper.findFoodIdByClassName(className);
    }
}
